home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group95b.txt
/
000142_icon-group-sender _Wed Aug 30 12:25:00 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-09-18
|
4KB
Received: by cheltenham.cs.arizona.edu; Wed, 30 Aug 1995 09:57:07 MST
Message-Id: <199508301641.MAA09868@transfer.stratus.com>
Date: Wed, 30 Aug 95 12:25 EDT
From: Steve_Graham@vos.stratus.com
To: icon-project@cs.arizona.edu
Cc: Steve_Graham@vos.stratus.com
Subject: Question
Errors-To: icon-group-errors@cs.arizona.edu
Dear Sir/Madam:
I had originally sent this to icon-info@cs.arizona.edu. However, it
was returned due to unknown user. I will try an alternate address.
Thanks.
--------------------------Original Letter--------------------------------
Dear Sir/Madam:
I've read with interest the entries in the comp.lang.icon newgroup and
have ordered a copy of Icon. I enjoy the many built-in features which
can facilitate many text manipulation tasks.
I do have a question about the attached program which I am developing. I
am hoping that someone can point out what I am doing wrong. I am sending
this via e-mail, inasmuch as I do not have the capability to post to the
conference, although I can read posted messages. Perhaps someone could post
this to the conference.
I am trying to prompt the user to put in a file name. The good news is
the program does receive the program name which I type in. The bad news is
that I do not see the prompt(s) until after I type in the file name. The
problem may be that I do not know how to stipulate to which file (ie, CON) I
am writing. Any comments?
Thanks in advance.
Steve_Graham@vos.stratus.com
#
# CORRECT .H FILE
#
# This program fixes the following problems in the t2a*.h file:
#
# . Eliminates duplicate numbers;
# . Corrects the _APS_NEXT_CONTROL_VALUE value; and
# . Positions the MF_F and MF_V fields together
procedure main()
local i,j
static numbers
initial numbers := "0"
every i1 := ( 1 to 9 ) do
numbers := numbers || i1
con_file_name := "CON.XXX"
write("Calling getfile with ",con_file_name)
write("Prompting for source file: ")
in_file_name := getfile()
write("Calling storelines")
storelines(con_file_name,in_file_name,numbers)
end
procedure getfile(con_file_name)
in_file_name := read()
return (in_file_name)
end
procedure storelines(con_file_name,in_file_name,numbers)
local i, j, line, linelist, lines, nbr, pair, t, x, y
static letters
initial letters := &lcase ++ &ucase
lines := table(0)
t := 0
write("in_file_name(SP): ",in_file_name)
in_file_num := open(in_file_name,"ru")
while line := read(in_file_num) do {
t := t + 1
nbr := 1000 + t
nbr := nbr[2:0]
lines[nbr] := line
}
linelist := sort(lines)
define_nums := table(0)
write("The ",t," lines are: ")
every pair := !linelist do {
if (i := find("#define",pair[2])) = 1
then {
write(pair[1],": ",pair[2])
j := findnumber(pair[2],numbers)
k := define_nums[j] + 1
define_nums[j] := k
write(" -->",j)
if k>1 then write(" *** Duplicate ***")
}
else write(pair[1],": ",pair[2])
}
define_num_list := sort(define_nums)
every pair := !define_num_list do
write(pair[1],": ",pair[2])
end
procedure findnumber(linea,numbers)
local i, substr
substr := ""
linea ? if (i := find(" ",linea))>10 then {
i := tab(i)
i := tab(upto(numbers))
substr := tab(many(numbers))
}
return substr
end